//Gets the browser specific XmlHttpRequest Object
function getXmlHttpRequestObject() {
	if (window.XMLHttpRequest) {
		return new XMLHttpRequest(); //Not IE
	} else if(window.ActiveXObject) {
		return new ActiveXObject("Microsoft.XMLHTTP"); //IE
	} else {
		//Display your error message here.
		//and inform the user they might want to upgrade
		//their browser.
		alert("Your browser doesn't support the XmlHttpRequest object.  Better upgrade to Firefox.");
	}
}
//Get our browser specific XmlHttpRequest object.
var receiveReq = getXmlHttpRequestObject();
//Initiate the asyncronous request.
function getInfo(which,align) {
	//If our XmlHttpRequest object is not in the middle of a request, start the new asyncronous call.
	if (receiveReq.readyState == 4 || receiveReq.readyState == 0) {
		//Setup the connection as a GET call to the specified html.
		//True explicity sets the request to asyncronous (default).

		receiveReq.open("GET", 'obs_new.php?platform='+which, true);

		//Set the function that will be called when the XmlHttpRequest objects state changes.
		if (align == 'right') {
		receiveReq.onreadystatechange = handleGetInfoRight;
		}
		else {
		receiveReq.onreadystatechange = handleGetInfo;
		}
	
		//Make the actual request.
		receiveReq.send(null);
	}
}
//Called every time our XmlHttpRequest objects state changes.
function handleGetInfoRight() {
	//Check to see if the XmlHttpRequests state is finished.
	if (receiveReq.readyState == 4) {
		//Set the contents of our div element to the result of the asyncronous call.
		document.getElementById('mapdata_right').innerHTML = receiveReq.responseText;
		document.getElementById('mapdata_right').style.display = "block";
        	document.getElementById('mapdata_right').style.visibility = "visible";
	}
}

function handleGetInfo() {
        //Check to see if the XmlHttpRequests state is finished.
        if (receiveReq.readyState == 4) {
                //Set the contents of our div element to the result of the asyncronous call.
                document.getElementById('mapdata').innerHTML = receiveReq.responseText;
                document.getElementById('mapdata').style.display = "block";
                document.getElementById('mapdata').style.visibility = "visible";
        }
}

function hideInfo() {
        document.getElementById('mapdata').style.visibility = "hidden";
        document.getElementById('mapdata_right').style.visibility = "hidden";
}

